//
//  JMConcernProfessViewMode.m
//  VoluntaryStar
//
//  Created by xiaorui on 15/9/5.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "JMConcernProfessViewMode.h"
#import "JMAppNetworkClient.h"
#import "JMConcernProfessional.h"

@interface JMConcernProfessional ()

+(NSMutableArray *)dataModel:(NSArray *)array;
@end

@implementation JMConcernProfessViewMode

+ (void) fetchConcerProfessMessageParametes:(NSDictionary *)dict  block:(ReturnBackMessage)block{
    [JMAppNetworkClient concernProfessListWithInfo:dict complete:^(id data, NSError *error) {
        NSLog(@"%@",data);
        NSMutableDictionary *downDict = (NSMutableDictionary *)data;
        if([[downDict objectForKey:@"status"] integerValue] == 1){
            NSMutableArray *array = [JMConcernProfessViewMode dataModel:downDict[@"list"]];
            block(data,error,array);
        }else{
            block(data,error,nil);
        }
    }];
}

+(NSMutableArray *)dataModel:(NSArray *)array{
    NSMutableArray *mArray = [[NSMutableArray alloc]initWithCapacity:0];
    for(int i = 0; i <array.count;i++){
        NSDictionary *dict = array [i];
        NSLog(@"%@",dict);
        JMConcernProfessional *mode = [[JMConcernProfessional alloc]init];
        mode.titleName =dict[@"name"];
        mode.professionalId =  [dict[@"id"] intValue];
        mode.jieshao = dict[@"jieshao"];
        mode.attention = @"1";
        [mArray addObject:mode];
    }
    return mArray;
    
}
@end
